.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  height: 600px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.chat-header {
  padding: 15px;
  background: #2196f3;
  color: white;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f5f5f5;
}

.message {
  margin: 8px 0;
  padding: 10px;
  border-radius: 8px;
  max-width: 85%;
  word-wrap: break-word;
}

.user-message {
  background: #e3f2fd;
  margin-left: auto;
  color: #1565c0;
}

.ai-message {
  background: white;
  margin-right: auto;
  color: #333;
  border: 1px solid #e0e0e0;
  font-size: 14px;
  line-height: 1.6;
  padding: 15px;
}

.file-upload {
  padding: 10px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#file-input {
  flex: 1;
  padding: 5px;
}

#upload-btn {
  padding: 5px 10px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.chat-options {
  padding: 10px;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.chat-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #666;
}

.chat-input {
  padding: 15px;
  border-top: 1px solid #eee;
}

#user-input {
  width: 100%;
  height: 80px;
  resize: none;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

#send-btn {
  width: 100%;
  padding: 10px;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

#send-btn:hover {
  background: #1976d2;
}

#minimize-btn {
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  padding: 0 5px;
}

/* 加载动画 */
.loading-dots {
  display: inline-block;
}

.loading-dots span {
  animation: loading 1.4s infinite;
  display: inline-block;
  margin: 0 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2196f3;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.message.loading {
  background: white;
  padding: 10px;
  border-radius: 8px;
  margin: 5px 0;
  max-width: 80%;
  margin-right: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-container {
    width: 90%;
    height: 80vh;
    right: 5%;
    bottom: 10px;
  }
}

/* 文件上传状态 */
.upload-status {
  margin: 5px 0;
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
}

.upload-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.upload-error {
  background: #ffebee;
  color: #c62828;
}

/* 代码块样式 */
.code-block {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  margin: 10px 0;
  font-family: "Courier New", Courier, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
}

.c-code {
  color: #333;
  line-height: 1.5;
}

/* 章节标题样式 */
.section-title {
  color: #2196f3;
  margin: 20px 0 10px 0;
  padding-bottom: 5px;
  border-bottom: 2px solid #e0e0e0;
}

/* 代码高亮 */
.c-code .keyword {
  color: #0033b3;
}
.c-code .comment {
  color: #008000;
}
.c-code .string {
  color: #067d17;
}
.c-code .number {
  color: #1750eb;
}

.section {
  margin: 15px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.3s ease-out;
}

.section p {
  margin: 8px 0;
  line-height: 1.6;
}

.section pre {
  margin: 10px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 4px;
  overflow-x: auto;
}

.section code {
  font-family: "Fira Code", monospace;
  font-size: 14px;
}

.section h3 {
  color: #1565c0;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
  border-bottom: 2px solid #e3f2fd;
  padding-bottom: 5px;
}

.code-block {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  margin: 10px 0;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
  position: relative;
}

.code-block::before {
  content: "C";
  position: absolute;
  top: 5px;
  right: 10px;
  color: #9e9e9e;
  font-size: 12px;
}

/* 代码高亮 */
.c-code .keyword {
  color: #0033b3;
  font-weight: bold;
}
.c-code .string {
  color: #067d17;
}
.c-code .comment {
  color: #008000;
  font-style: italic;
}
.c-code .function {
  color: #6f42c1;
}
.c-code .number {
  color: #1750eb;
}

#clear-file-btn {
  padding: 5px 10px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 10px;
}

#clear-file-btn:hover {
  background: #d32f2f;
}

/* 试卷容器 */
.exam-container {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 章节标题 */
.section-header {
  color: #1565c0;
  border-bottom: 2px solid #e3f2fd;
  padding-bottom: 8px;
  margin: 20px 0 15px;
  font-size: 18px;
}

/* 代码容器 */
.code-container {
  position: relative;
  margin: 15px 0;
}

/* 复制按钮 */
.copy-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 5px 10px;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.copy-btn:hover {
  opacity: 1;
}

/* 下载按钮 */
.download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.3s;
}

.download-btn:hover {
  background: #388e3c;
}

/* 高亮文本 */
.highlight {
  background: #e3f2fd;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
}

/* JSON查看器样式 */
.json-view {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
  color: #333;
}

/* 工具栏样式 */
.toolbar {
  position: sticky;
  top: 0;
  background: white;
  padding: 10px;
  border-bottom: 1px solid #eee;
  z-index: 100;
  display: flex;
  gap: 10px;
}

/* 按钮通用样式 */
.toolbar button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

/* 流式输出动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  animation: fadeIn 0.3s ease-out;
}

/* 题目卡片样式 */
.question-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  padding: 20px;
  transition: transform 0.2s;
}

.question-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 题目头部样式 */
.question-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e3f2fd;
}

.question-number {
  font-size: 18px;
  font-weight: bold;
  color: #1565c0;
  margin-right: 15px;
}

.question-type {
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
}

.question-type.choice {
  background: #e3f2fd;
  color: #1565c0;
}

.question-type.blank {
  background: #e8f5e9;
  color: #2e7d32;
}

.question-type.programming {
  background: #fff3e0;
  color: #e65100;
}

/* 选项样式 */
.option {
  padding: 10px 15px;
  margin: 8px 0;
  background: #f5f5f5;
  border-radius: 4px;
  transition: background 0.2s;
}

.option:hover {
  background: #e3f2fd;
}

/* 答案和解析样式 */
.answer-section,
.explanation-section {
  margin: 15px 0;
  padding: 15px;
  border-radius: 4px;
}

.answer-section {
  background: #e8f5e9;
}

.explanation-section {
  background: #fff3e0;
}

/* 题目容器样式 */
.question-container {
  margin: 20px 0;
  animation: slideIn 0.3s ease-out;
}

.question {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin: 15px 0;
  transition: transform 0.2s;
}

.question:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.question-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 15px;
}

.choice-question .question-type {
  background: #e3f2fd;
  color: #1565c0;
}

.programming-question .question-type {
  background: #fff3e0;
  color: #e65100;
}

.question-title {
  color: #1565c0;
  font-size: 18px;
  margin: 10px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #e3f2fd;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 15px 0;
}

.option {
  padding: 10px 15px;
  background: #f5f5f5;
  border-radius: 6px;
  transition: background 0.2s;
}

.option:hover {
  background: #e3f2fd;
}

.answer,
.explanation {
  margin: 15px 0;
  padding: 15px;
  border-radius: 6px;
}

.answer {
  background: #e8f5e9;
}

.explanation {
  background: #fff3e0;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
